/*
2021-7-13
https://ac.nowcoder.com/acm/contest/17942/H
*/
#include <iostream>

#define x first
#define y second

using namespace std;

typedef pair<int, int> PII;

const int N = 1e6 + 10;

int n, m;
PII stk[N];
int res[N];

int main()
{
    cin >> n >> m;

    int tt = -1;
    while (m -- )
    {
        int p, q;
        cin >> p >> q;
        if (!p)
        {
            while (tt >= 0 && stk[tt].x == 0) q = max(q, stk[tt -- ].y);
            while (tt >= 1 && stk[tt - 1].y <= q) tt -= 2;
            stk[ ++ tt] = {p, q};
        }
        else if (tt >= 0)
        {
            while (tt >= 0 && stk[tt].x == 1) q = min(q, stk[tt -- ].y);
            while (tt >= 1 && stk[tt - 1].y >= q) tt -= 2;
            stk[ ++ tt] = {p, q};
        }
    }
    int k = n, l = 1, r = n;
    for (int i = 0; i <= tt; ++ i)
    {
        if (stk[i].x == 0)
            while (r > stk[i].y && l <= r)
                res[r -- ] = k -- ;
        else
            while (l < stk[i].y && l <= r)
                res[l ++ ] = k -- ;
    }
    if (tt & 1)
        while (l <= r)
            res[r -- ] = k -- ;
    else
        while (l <= r)
            res[l ++ ] = k -- ;
    for (int i = 1; i <= n; ++ i) cout << res[i] << " ";
    cout << endl;
    return 0;
}


